package com.cin.cma.client.service.impl;


import cn.hutool.http.HttpRequest;
import com.cin.cma.client.service.IHttpService;
import com.cin.cma.client.service.IMaoyanService;
import com.cin.cma.common.model.SocketResponse;
import com.cin.cma.common.util.UserAgentUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MaoyanServiceImpl implements IMaoyanService {
    @Autowired
    private IHttpService httpService;

    /**
     * 请求数据
     *
     * @param body 内容
     * @return 返回内容
     */
    @Override
    public void request(String body) {
        SocketResponse socketResponse = this.httpService.request(body, (socketRequest) ->
                HttpRequest.get(socketRequest.getRequestUrl()).header("User-Agent", UserAgentUtil.get()).execute());
        System.out.println("maoyan.data=" + socketResponse);
    }
}
